/**
 * Copyright 2012 Fonfon.Fenceer
 * All rights reserved.
 * 
 * @project 
 * @author Fonfon.Fenceer
 * @version 1.0
 * @data 2012-3-11
 */
package com.guidecaptain.java.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.guidecaptain.java.mapper.CardMapper;
import com.guidecaptain.java.model.pojo.Card;
import com.guidecaptain.java.service.CardService;

/**
 *  
 * @author fonfon
 */
@Service("cardService")
public class CardServiceImpl implements CardService{
	@Autowired
	private CardMapper cardMapper;

	/** 
	 * @param 
	 * @return 
	 */
	@Override
	public int insertCard(Card card) {
		
		return cardMapper.insertCard(card);
	}
		
	/**
	 * @param 
	 * @return
	 */
	@Override
	public int deleteCard(int cardId) {
		
		return cardMapper.deleteCard(cardId);
	}

	/** 
	 * @param 
	 * @return 
	 */
	@Override
	public int updateCard(Card card) {
		
		return updateCard(card);
	}

	/** 
	 * @param 
	 * @return 
	 */
	@Override
	public Map<Integer, String> queryCardMap(){
		List<Card> cards=cardMapper.queryCardList();
		Map<Integer, String> cardMap=new HashMap<Integer, String>();
		for(Card card:cards){
			cardMap.put(card.getCardId(), card.getCardName());
		}
		
		return cardMap; 
	}

	/** 
	 * @param 
	 * @return 
	 */
	@Override
	public List<Card> queryCardList() {
		
		return cardMapper.queryCardList();
	}

}
